<template>
	<view class="wrap">
		<!-- <js-lang title="home.title" :showBtn="true"></js-lang> -->
		<u-swiper :height="300" :list="imgList" :title="false" @click="imgListClick"></u-swiper>
		<view class="toolbar u-m-b-20">
			<u-grid class="grid" :col="3" :border="false">
				<u-grid-item :index="0" @click="navTo('/pages/bpm/myTaskTodo')">
					<u-badge :count="todoCount"></u-badge>
					<u-icon class="grid-icon" name="clock" :size="80" :style="{ color: '#ea9a44' }"></u-icon>
					<view class="grid-text">待办任务</view>
				</u-grid-item>
				<u-grid-item :index="1" @click="navTo('/pages/bpm/myTaskHistory')">
					<u-icon class="grid-icon" name="checkmark-circle" :size="80" :style="{ color: '#47cb66' }"></u-icon>
					<view class="grid-text">已办任务</view>
				</u-grid-item>
				<u-grid-item :index="2" @click="navTo('/pages/bpm/myRuntime')">
					<u-icon class="grid-icon" name="order" :size="80" :style="{ color: '#5a98ea' }"></u-icon>
					<view class="grid-text">我相关的</view>
				</u-grid-item>
			</u-grid>
		</view>

		<!-- Original Menu -->
		<u-collapse style="display: none;" class="box u-p-b-5" :accordion="true" :arrow="true">
			<view class="item" v-for="(menu, index) in menuList" :key="menu.menuCode">
				<u-collapse-item :open="false">
					<view class="title" slot="title">
						<u-icon :name="menu.menuIcon != '' ? menu.menuIcon : 'home'" :size="40"
							:style="{ color: menu.menuColor != '' ? menu.menuColor : '#666' }"></u-icon>
						<view class="text" :style="{ color: menu.menuColor != '' ? menu.menuColor : '#666' }"
							>{{menu.menuName}}</view>
					</view>
					<u-grid class="grid u-m-t-20" :col="3" :border="false">
						<u-grid-item v-for="(child, index2) in menu.childList" :key="child.menuCode" @click="navTo(child.url)">
							<u-icon class="grid-icon" :name="child.menuIcon != '' ? child.menuIcon : 'order'" :size="80"
								:style="{ color: child.menuColor != '' ? child.menuColor : '#666' }"></u-icon>
							<view class="grid-text" :style="{ color: child.menuColor != '' ? child.menuColor : '#666' }"
								>{{child.menuName}}</view>
						</u-grid-item>
					</u-grid>
				</u-collapse-item>
			</view>
		</u-collapse>

		<!-- 功能管理 -->
		<view class="advanced-functions card u-m-b-20">
			<view class="title">功能管理</view>
			<u-grid class="grid" :col="4" :border="false">
				<u-grid-item v-for="(item, index) in functionList" :key="index" @click="navTo(item.url)">
					<view class="grid-item-content">
						<u-icon :style="{ color: item.color != '' ? item.color : '#000' }" class="grid-icon" :name="item.icon" :size="70"></u-icon>
						<view class="grid-text">{{ item.name }}</view>
					</view>
				</u-grid-item>
			</u-grid>
		</view>

	</view>
</template>

<script>
/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
export default {
	data() {
		return {
			imgList: [
				{image: '/static/jeesite/banner/1.svg'},
				{image: '/static/jeesite/banner/2.svg'},
				{image: '/static/jeesite/banner/3.svg'}
			],

			todoCount: 0,

			// Original menuList (preserved)
			menuList: [
				{
					menuCode: 'a-1',
					menuName: '录入管理',
					menuIcon: 'file-text',
					menuColor: '',
					url: '',
					childList: [
						{
							menuCode: 'a-1-1',
							menuName: '合买',
							menuIcon: 'calendar',
							menuColor: '',
							url: '/pages/salesManagement/buytogether?type=1',
						},
						{
							menuCode: 'a-1-2',
							menuName: '帮分店出票',
							menuIcon: 'hand-up-fill',
							menuColor: '',
							url: '/pages/salesManagement/buytogether?type=2',
						},
						{
							menuCode: 'a-1-3',
							menuName: '给分店出票',
							menuIcon: 'gift-fill',
							menuColor: '#2D56B2',
							url: '/pages/salesManagement/buytogether?type=3',
						},
						{
							menuCode: 'a-1-4',
							menuName: '本店销量',
							menuIcon: 'file-text',
							menuColor: '#2D56B2',
							url: '/pages/salesManagement/buytogether?type=4',
						},
						{
							menuCode: 'a-1-5',
							menuName: '体彩佣金',
							menuIcon: 'rmb-circle',
							menuColor: '#F43530',
							url: '/pages/salesManagement/buytogether?type=5',
						},
						{
							menuCode: 'a-1-6',
							menuName: '福彩佣金',
							menuIcon: 'gift-fill',
							menuColor: '#F43530',
							url: '/pages/salesManagement/buytogether?type=6',
						},
						{
							menuCode: 'a-1-7',
							menuName: '即开佣金',
							menuIcon: 'star-fill',
							menuColor: '#F43530',
							url: '/pages/salesManagement/buytogether?type=7',
						},
						{
							menuCode: 'a-1-8',
							menuName: '其他佣金',
							menuIcon: 'star-fill',
							menuColor: '#F43530',
							url: '/pages/salesManagement/buytogether?type=8',
						},
						{
							menuCode: 'a-1-9',
							menuName: '开支录入',
							menuIcon: 'calendar',
							menuColor: '#41A863',
							url: '/pages/salesManagement/buytogether?type=9',
						},
					]
				},
				{
					menuCode: 'a-2',
					menuName: '报表查询',
					menuIcon: 'file-text',
					menuColor: '#2D56B2',
					url: '',
					childList: [
						{
							menuCode: 'a-2-1',
							menuName: '销量报表',
							menuIcon: 'calendar',
							menuColor: '#2D56B2',
							url: '/pages/report/saleReport?type=10',
						},
						{
							menuCode: 'a-2-2',
							menuName: '分店出票统计',
							menuIcon: 'calendar',
							menuColor: '#2D56B2',
							url: '/pages/report/branchTicketingReport?type=11',
						},
						{
							menuCode: 'a-2-3',
							menuName: '合买出票统计',
							menuIcon: 'calendar',
							menuColor: '#2D56B2',
							url: '/pages/report/jointTicketingReport?type=12',
						},
						{
							menuCode: 'a-2-4',
							menuName: '佣金报表',
							menuIcon: 'calendar',
							menuColor: '#2D56B2',
							url: '/pages/report/commissionReport?type=13',
						},
						{
							menuCode: 'a-2-5',
							menuName: '支出报表',
							menuIcon: 'calendar',
							url: '/pages/report/report?type=3',
						},
					]
				},
				{
					menuCode: 'a-3',
					menuName: '缴款管理',
					menuIcon: 'file-text',
					menuColor: '#EA9E4B',
					url: '',
					childList: [
						{
							menuCode: 'a-3-1',
							menuName: '店铺缴款',
							menuIcon: 'calendar',
							menuColor: '#EA9E4B',
							url: '/pages/paymentManagement/paymentManagement?type=13',
						},
					]
				},
				{
					menuCode: 'a-10',
					menuName: '功能列表',
					menuIcon: '',
					menuColor: '#0d9311',
					url: '',
					childList: [
						{
							menuCode: 'a-10-1',
							menuName: '找回密码',
							menuIcon: '',
							menuColor: '#0d9311',
							url: '/pages/sys/login/forget',
						},
						{
							menuCode: 'a-10-3',
							menuName: '注册用户',
							menuIcon: '',
							url: '/pages/sys/login/reg',
						},
						{
							menuCode: 'a-10-4',
							menuName: '个人资料',
							menuIcon: '',
							url: '/pages/sys/user/info',
						},{
							menuCode: 'a-10-5',
							menuName: '关于我们',
							menuIcon: '',
							url: '/pages/sys/user/about',
						},
						{
							menuCode: 'a-10-6',
							menuName: '修改密码',
							menuIcon: '',
							url: '/pages/sys/user/pwd',
						},
						{
							menuCode: 'a-10-7',
							menuName: '意见反馈',
							menuIcon: '',
							url: '/pages/sys/user/comment',
						},
						{
							menuCode: 'a-10-8',
							menuName: '系统设置',
							url: '/pages/sys/user/setting',
						},
						{
							menuCode: 'a-10-9',
							menuName: '列表演示',
							menuIcon: '',
							url: '/pages/testData/list',
						},
						{
							menuCode: 'a-10-10',
							menuName: '表单演示',
							menuIcon: '',
							url: '/pages/testData/form',
						}
					]
				},
			],
			functionList: [
				{ 
					name: '找回密码', 
					icon: 'lock', 
					url: '/pages/sys/login/forget'
				},
				{ 
					name: '注册用户', 
					icon: 'account', 
					url: '/pages/sys/login/reg'
				},
				{ 
					name: '个人资料', 
					icon: 'account', 
					url: '/pages/sys/user/info'
				},
				{ 
					name: '修改密码', 
					icon: 'lock', 
					url: '/pages/sys/user/pwd'
				},
				{ 
					name: '意见反馈', 
					icon: 'chat', 
					url: '/pages/sys/user/comment'
				},
				{ 
					name: '系统设置', 
					icon: 'setting', 
					url: '/pages/sys/user/setting'
				},
				
			],

		};
	},

	onLoad() {
		
	},

	onShow() {
		this.refreshCount();
		uni.redirectTo({
			url: '/pages/common/webview?url=' + encodeURIComponent('https://sc.qisemiyun.com/#/pages/main/main?ShortKey=G65mL9z')
		})
	},
	methods: {
		navTo(url) {
			uni.navigateTo({
				url: url
			});
		},
		refreshCount() {
			// 获取待办个数
			this.todoCount = 0
		},
		imgListClick(index) {
			console.log(`点击了第${index + 1}页图片`)
		},
	}
};
</script>

<style lang="scss">
@import 'index.scss';
page {
	background-color: #f8f8f8;
}

.card {
	background-color: #fff;
	border-radius: 20rpx;
	margin: 20rpx;
	padding: 20rpx;
	box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
}

.title {
	font-size: 24rpx;
	color: #666;
	// font-weight: bold;
	margin-bottom: 20rpx;
	padding-left: 10rpx;
}

.grid-item-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 10rpx 0;
}

.grid-icon {
	margin-bottom: 10rpx;
}

.grid-text {
	font-size: 26rpx!important;
	color: #000;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
</style>

